/**
 * This class sends emails to a user to inform them of changes to their order.
 * Nota bene: for the purposes of this assignment the code will only display a
 * console message to indicate which email should be sent in which case.
 */
public class Emailer {

    public static final String ORDER_RECEIVED_EMAIL = "email: order received";
    public static final String ESTIMATE_RECEIVED_EMAIL = "email: estimate received";
    public static final String ORDER_CANCELLED_EMAIL = "email: order cancelled";
    public static final String ORDER_CONFIRMED_EMAIL = "email: order confirmed";

    /**
     * This is a static method that sends an email to a user regarding an order.
     * The code checks the status of the order and sends an appropriate email
     * depending on where the order is in the overall process of completion.
     *
     * @param order The order that was placed
     * @return Returns true if an email was successfully sent
     */
    public static boolean createEmail(Order order) {
        switch(order.getStatus()) {
            case Order.ORDER_RECEIVED:
                System.out.println(ORDER_RECEIVED_EMAIL);
                break;
            case Order.ESTIMATE_RECEIVED:
                System.out.println(ESTIMATE_RECEIVED_EMAIL);
                break;
            case Order.ORDER_CANCELLED:
                System.out.println(ORDER_CANCELLED_EMAIL);
                break;
            case Order.ORDER_CONFIRMED:
                System.out.println(ORDER_CONFIRMED_EMAIL);
                break;
            default:
                return false;
        }
        return true;
    }

}
